table.CHANGE_END Function

Syntax

V Change_End([L commit[,L updateUI]])

Arguments

commit

Optional. Default = .T. (TRUE) TRUE (.T.) = the proposed field changes in the record buffer are written to the file. FALSE (.F.) = flag value aborts the field changes without changing the record.

updateUI

Logical

Description

End changes to tables current record.

Discussion

The <TBL>.CHANGE_END() method is used when changes to fields in the record buffer are complete, to save the field values in the current record. It must be preceded by a <TBL>.CHANGE_BEGIN() on the same table pointer. Bad field values (i.e., that violate field rules or the field data type) will be found by Alpha Anywhere at the time the field value is assigned. This will cause a run-time error that you should intercept with an error handling routine. Note : Any run-time error that occurs between a <TBL>.CHANGE_BEGIN and its corresponding <TBL>.CHANGE_END()will stop script execution and leave you in Change mode. To avoid this, use an ON ERROR GOTO statement before the <TBL>.CHANGE_BEGIN to set up an error handler for the Change operation.

Example

Change the value in the COUNTRY field.

'If an error occurs the commit_flag will be set to FALSE (.F.).
tbl = table.current()
if tbl.mode_get()> 0 then
    'Compute the Message Type code
    code = UI_ATTENTION_SYMBOL
    ui_msg_box("Warning", "Already in data entry mode.", code)
else
    commit_flag = .T.
    tbl.change_begin()
    ON ERROR GOTO error_handler
    tbl.country = "USA"
    tbl.change_end(commit_flag)
end if
end
error_handler:
     commit_flag = .F.
RESUME NEXT

See Also